package com.linjuke.mayouting.web.modules.action.biz;

import com.linjuke.mayouting.biz.ao.ItemAO;
import com.linjuke.mayouting.web.common.BaseAction;
import com.zjuh.splist.web.RunData;
import com.zjuh.splist.web.TemplateContext;
import com.zjuh.sweet.result.Result;

public class ItemAction extends BaseAction {
	
	private ItemAO itemAO;
	
	public void doDisAgree(RunData rundata, TemplateContext templateContext) {
		long itemId = rundata.getQueryString().getLong("itemId");
		Result result = itemAO.disAgreeItem(itemId);
		if (result.isSuccess()) {
			this.sendToModule("baseModule", "biz/item/list");
		} else {
			this.handleError(result, rundata, templateContext);
		}
	}
	
	public void doCommitItem(RunData rundata, TemplateContext templateContext) {
		long itemId = rundata.getQueryString().getLong("itemId");
		int catId = rundata.getQueryString().getInt("catId");
		Result result = itemAO.commitItem(itemId, catId);
		if (result.isSuccess()) {
			this.sendToModule("baseModule", "biz/item/list");
		} else {
			this.handleError(result, rundata, templateContext);
		}
	}

	public void setItemAO(ItemAO itemAO) {
		this.itemAO = itemAO;
	}

}
